//package com.example.service.impl;/**
// * @author wangXiao
// */
//
//import com.example.entity.SysUser;
//import com.example.security.bean.CustomUser;
//import com.example.service.SysUserService;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//
//import javax.annotation.Resource;
//import java.util.Collections;
//import java.util.Objects;
//
///**
// * @Description: TODO
// * @Author wangXiao
// * @Date 2024/10/10
// **/
//public class UserDetailsServiceImpl implements UserDetailsService {
//
//    @Resource
//    private SysUserService sysUserService;
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//        SysUser sysUser = sysUserService.queryByUsername(username);
//        if (Objects.isNull(sysUser)){
//            throw new UsernameNotFoundException("用户名不存在！");
//        }
//
//        if(sysUser.getStatus() == 0) {
//            throw new RuntimeException("账号已停用");
//        }
//        return new CustomUser(sysUser, Collections.emptyList());
//
//    }
//}
